package com.mazong.serversecaa.pojo;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

public class TbUser implements UserDetails {
    private Integer id;
    private String username;
    private String password;

    //
    private List<TbRole> authorities;

    // 权限集合
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    // 用户密码
    @Override
    public String getPassword() {
        return this.password;
    }

    // 用户名称
    @Override
    public String getUsername() {
        return this.username;
    }

    // 用户是否过期
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    // 用户锁定状态
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    // 密码是否过期
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    // 是否启用
    @Override
    public boolean isEnabled() {
        return true;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setAuthorities(List<TbRole> authorities) {
        this.authorities = authorities;
    }
}
